VC10MkTime

Introducing a date and time (day, mounth, year, hours, minutes, seconds) the VC10MkTime function gives the number of seconds elapsed from 00:00 of the 1 January 1970 until the introduced date.
This is useful to be able to make comparisons between dates.
The function also runs day and month values greater than its natural limits (day > 31 or mounth > 12), automatically calculating the date.

IMPLEMENTATION

VC10MkTime (aglParam, glSumSec)

Parameters:

IN/OUTVARIABLE TYPEEXAMPLE NAMEDIM
IN ARRGBL aglParam[01] L Day [>0]
IN ARRGBL aglParam[02] L Month [>0]
IN ARRGBL aglParam[03] L Year [1970÷2037]
IN ARRGBL aglParam[04] L Hour [0÷23]
IN ARRGBL aglParam[05] L Minutes [0÷59]
IN ARRGBL aglParam[06] L Seconds [0÷59]
OUT ARRGBL aglParam[07] L Day of the week:
0 = sunday
1 = monday
2 = tuesday
3 = wednesday
4 = thursday
5 = friday
6 = saturday
OUT ARRGBL aglParam[08] L Number of days gone by than the 1 January of the year introduced
OUT ARRGBL aglParam[09] L Error type:
0 = No
1 = Day ≤ 0
2 = Month ≤ 0
3 = Year introduced off limits [1970÷2037]
OUT GLOBAL glSumSec L Sum of seconds elapsed from 00:00 of 1 January 1970 until date introduced

Esempio

Si vuole attivare una uscita digitale (ofUscita01) quando la data e l'ora attuale supera una data e un'ora impostata precedentemente.

;Data Attuale
aglParam[1] = 25
aglParam[2] = 6
aglParam[3] = 2009
aglParam[4] = 15
aglParam[5] = 30
aglParam[6] = 55
VC10MkTime (aglParam, glSumSec)
glSecActual = glSumSec			;Valore in secondi della data attuale
 
;Data da confrontare
aglParam[1] = 1
aglParam[2] = 1
aglParam[3] = 2010
aglParam[4] = 18
aglParam[5] = 00
aglParam[6] = 00
VC10MkTime (aglParam, glSumSec)
glSecExpiry = glSumSec			;Valore in secondi della data di scadenza
 
IF glSecActual GT glSecExpiry
	SETOUT ofUscita01
ENDIF

Note di funzionamento